#!/bin/bash
$APPDIR/func -reset_gtk
export TEXTDOMAIN=pmusic
export OUTPUT_CHARSET=UTF-8
ACTION="$1"
[ ! "$MODE" ] && MODE=0 #0=normal, 1=save, 2=select_folder, 3=create_folder
[ ! "$TITLE" ] && TITLE=""
[ ! -d "$CHOOSER_DIR" ] && CHOOSER_DIR="$HOME"

export chooser='
<window title="pMusic '$TITLE'" icon-name="pmusic">
 <vbox>
  <chooser action="'$MODE'">
   <height>500</height><width>600</width>
   <variable>CHOOSER</variable>
   <default>'$CHOOSER_DIR'</default>
  </chooser>
  '$XML_CHOOSER'
  <hbox>
   <button cancel></button>
   <button can-default="true" has-default="true" use-stock="true">
    <input file icon="gtk-apply"></input>
    <label>'$(gettext 'Ok')'</label>
    <action type="exit">OK</action>
   </button>
  </hbox>
 </vbox>
</window>'
I=$IFS; IFS=""
for STATEMENTS in  $($GTKDIALOG -p chooser --center); do
eval $STATEMENTS
done
IFS=$I

[ $EXIT = "OK" ] || CHOOSER=''
